#ifndef HISTORYMANAGER_H
#define HISTORYMANAGER_H

#include <QObject>
#include <QString>
#include <QList>
#include <QPair>
#include <QMap>
#include <QSettings>

class HistoryManager : public QObject
{
    Q_OBJECT

public:
    explicit HistoryManager(QObject *parent = nullptr);

    void addMessage(const QString &conversationId, const QString &time,
                   const QString &question, const QString &answer);
    QList<QPair<QString, QString>> getMessages(const QString &conversationId);
    QMap<QString, QString> getConversationList();
    void clearAllHistory();
    void clearConversation(const QString &conversationId);

private:
    QSettings *m_historyStore;
    QString getFirstQuestion(const QString &conversationId);
};

#endif // HISTORYMANAGER_H
